﻿@using hc.epm.ViewModel;
@using hc.epm.DataModel.Basic;
@model IEnumerable<RegionView>
@{
    ViewBag.Title = "区域查询";
    Layout = "~/Views/Shared/_LayoutHc.cshtml";
}
<div class="content-right date-wrap fl c">
    <div class="search mt5">
        <form class="layui-form" action="" method="get">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">县名称 : </label>
                    <div class="layui-input-inline"><input type="text" name="name" placeholder="名称" autocomplete="off" class="layui-input" value="@ViewBag.name" /></div>
                </div>

                <input type="submit" class="layui-btn layui-btn-radius layui-btn-warm" lay-filter="search" value="搜 索" />
            </div>

        </form>
    </div>
    <div class="main mt5">

        <div class="layui-form">
            <table class="layui-table">
                <thead>
                    <tr>
                        <th width="8%">区域</th>
                        <th width="8%">区域编号</th>
                        <th width="15%">省</th>
                        <th width="20%">市</th>
                        <th width="20%">县</th>
                        <th>全称</th>

                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.Count() > 0)
                    {
                        foreach (var item in Model)
                        {
                            <tr>

                                <td>@item.Area</td>
                                <td>@item.Code</td>
                                <td>@item.Province</td>
                                <td>@item.City</td>
                                <td>@item.Region</td>
                                <td>@item.FullName</td>
                            </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="6">
                                暂无数据
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>

        <div id="page"></div>
    </div>
</div>
<script>
    layui.use(['layer', 'form', 'element', 'laypage', 'laydate'], function () {
        var layer = layui.layer, form = layui.form, element = layui.element, $ = layui.jquery, laypage = layui.laypage, laydate = layui.laydate;
        //分页
        laypage.render({
            elem: 'page',
            count: '@ViewBag.Total',
            curr: '@ViewBag.pageIndex',
            layout: ['prev', 'page', 'next', 'skip', 'count', ],
            jump: function (obj, first) {
                if (!first) {
                    //得到了当前页，用于向服务端请求对应数据
                    var curr = obj.curr;
                    var search = $("form").serialize();
                    window.location.href = "/HcRegion/Index?pageIndex=" + curr + "&" + search;
                }
            }
        });
    });
</script>

